package com.jia.train.batch.job;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

//@Component
//@EnableScheduling
public class SingleSpringJob {

    // Spring 自带的定时任务
    public static final Logger logger = LoggerFactory.getLogger(SingleSpringJob.class);

    @Scheduled(cron = "0/10 * * * * *")
    public void task() {
        // 增加分布式锁 解决集群问题
        logger.info("执行任务,每10秒运行一次");
    }

}
